// Sunghan Cho
// 301140084
// sunghanc@sfu.ca

#include "course.h"
#include <QDebug>

Course::Course() : Item()
{
    m_name = "";
    m_semester = "";
}

Course::Course(QString name, QString semester) : Item()
{
    m_name = name;
    m_semester = semester;
}

int Course::getFieldCount()
{
    return 2;
}

QString Course::getFieldHeading(int fieldIndex)
{
    if(fieldIndex == 0){
        return "Course";
    }

    else if(fieldIndex == 1){
        return "Semester";
    }
    //qDebug()<<"Course::getFieldHeading index out of range";
    return 0;
}

QVariant Course::getFieldValue(int fieldIndex)
{
    if(fieldIndex == 0){
        return m_name;
    }
    else if(fieldIndex == 1){
        return m_semester;
    }
    //qDebug()<<"Course::getFieldValue index out of range";
    return 0;
}

bool Course::matchesPrimaryField(QVariant value)
{
    if(value == m_name){
        return true;
    }
    return false;
}

QString Course::getName()
{
    return m_name;
}

QString Course::getSemester()
{
    return m_semester;
}
